// import OrderAdminTable from './components/table.vue'
import { OrderStatus } from "@/api/modules/order";
import { useState, useEffect } from "react";
import { Tabs } from "antd";
import Table from "./components/table";
// 初始化
export interface ListQuery {
	page: number;
	size: number;
	total: number;
	orderStatus: OrderStatus;
}
interface OrderStatusListItem {
	key: string;
	label: string;
	children?: React.ReactNode;
}
const orderAdminList = () => {
	/**
	 * 订单状态列表
	 */
	const orderStatusList: OrderStatusListItem[] = Object.keys(OrderStatus).map(item => {
		const label = orderStatusText(item) || "未知状态";
		return {
			key: item,
			label,
			children: <Table orderStatus={item as OrderStatus} />
		};
	});

	// 切换订单状态
	const onChange = (key: string) => {
		console.log(key);
	};
	return (
		<div className="orderAdminList">
			<Tabs type="card" defaultActiveKey="1" onChange={onChange} items={orderStatusList} />
		</div>
	);
};
function orderStatusText(status: string) {
	// 订单状态文案转换
	switch (status) {
		case "DFK":
			return "待付款";
		case "DFH":
			return "待发货";
		case "DSH":
			return "待收货";
		case "DPJ":
			return "待评价";
		case "YQX":
			return "已取消";
		case "YWC":
			return "已完成";
	}
}
export default orderAdminList;
